package com.tbit.uqbike.compalint.enums;

import java.util.Objects;

/**
 * 投诉平台来源枚举
 *
 * @author <a href="mailto:zhang.zhiliang@tbit.com.cn">Zhang ZhiLiang</a>
 * @version 1.0
 * @see <a href="http://adsl1.tbit.com.cn:21490/pages/viewpage.action?pageId=82182491">订单号规范</a>
 * @since 2025/2/14
 */
public enum PlatformEnum {
    WECHAT("微信",0,"WechatComplaintService"),
    ZFB("支付宝",1,"ZFBComplaintService"),
    ADAPAY("汇付",2,"adapayComplaintService"),
    ALL("全部",3,"commonComplaintService"),
    UNKNOWN("未知平台",-1,"commonComplaintService")
    ;

    private final String name;
    private final Integer code;
    private final String className;

    PlatformEnum(String name, Integer code, String className) {
        this.name = name;
        this.code = code;
        this.className = className;
    }

    public String getName() {
        return name;
    }
    public Integer getCode() {
        return code;
    }

    public String getClassName(){
        return className;
    }

    /**
     * 根据code 获取 平台
     * @param code
     * @return
     */
    public static PlatformEnum getByCode(Integer code){
        for (PlatformEnum value : PlatformEnum.values()) {
            if (Objects.equals(value.getCode(),code)){
                return value;
            }
        }
        return UNKNOWN;
    }

}
